// HelloWorldController.java
package com.buytouch.mobile.seller.mng.user;
 
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
 
@Controller
@RequestMapping("/mng")
public class UserController {
	
	@Resource
	private UserService mngService;
     
    @RequestMapping(value="/hellomng", method=RequestMethod.GET)
    public ModelAndView example() {
        return new ModelAndView("helloworld", "message", "Hello World");
    }
    
    @RequestMapping(value="/test", method=RequestMethod.GET)
    public ModelAndView get_test() {
    	String user_nm = mngService.get_test();
    	return new ModelAndView("helloworld", "message", "Hello World");
    }
    
    @RequestMapping(value="/insert_test", method=RequestMethod.GET)
    public ModelAndView insert_test() {
    	mngService.insert_test();
        return new ModelAndView("helloworld", "message", "Hello World");
    }
    
    @RequestMapping(value="/insert_mng_join")//, method=RequestMethod.POST)
    public ModelAndView insert_mng_join(@RequestParam Map<String, String> map) {
    	mngService.insert_mng_join(map);
        return new ModelAndView("helloworld", "message", "회원가입 완료!!");
    }
    
    
    //@RequestParam(value="id", required=false, defaultValue=1)
    @RequestMapping(value="/admin/branch/item_check_request")//, method=RequestMethod.POST)
    public ModelAndView item_check_request(@RequestParam(value="store_id", required=false) String store_id
    																					,HttpSession session) {
    	
    	/*
    	 * test
    	 */
    	session.setAttribute("store_id", "01043210030");
    	/*
    	 * test
    	 */
    	
    	//List list = mngService.item_check_request();
    	List cate_list = mngService.item_check_request_cate_nm((String)session.getAttribute("store_id"));
    	
    	ModelAndView mv = new ModelAndView("/mobile/admin/branch/item_check_request", "cate_list", cate_list);
    //	mv.addObject("list", list);
    	
        return mv;
    }
    
  //@RequestParam(value="id", required=false, defaultValue=1)
    @RequestMapping(value="/admin/branch/item_check_request_item_list")//, method=RequestMethod.POST)
    public ModelAndView item_check_request_item_list(@RequestParam(value="code_cate", required=true) String code_cate
    																					,HttpSession session) {
    	System.out.println("-------------실행 -----------------------");
    	/*
    	 * test
    	 */
    	session.setAttribute("store_id", "01043210030");
    	/*
    	 * test
    	 */
    	
    	List list = mngService.item_check_request_item_list((String)session.getAttribute("store_id"), code_cate);
    	
    	ModelAndView mv = new ModelAndView("/mobile/admin/branch/item_check_request_item_list", "list", list);
    	
        return mv;
    }
    
    
    
    
}